package com.tencent.welink.api.space.device.shadow;

import com.tencent.welink.api.OpenApiTokenChange;
import com.tencent.welink.api.base.WelinkOpenApi;
import com.tencent.welink.config.BussinessConfig;
import com.tencent.welink.util.CrontabUtil;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.Map;

/**
 * @Description: 获取设备影子数据
 * @Author: limye
 * @CreateDate: 2020-6-9
 * @Version: V1.0
 */
public class GetDeviceShadow extends WelinkOpenApi {

    private static final Logger log = LogManager.getLogger(GetDeviceShadow.class);

    public GetDeviceShadow(){
        super("/space/shadow/getDeviceShadow",true);
    }


    @Override
    public void displayResult(String result) {
    }


    public static void main(String[] args) {
        new BussinessConfig();
        CrontabUtil.addTaskInRate(new OpenApiTokenChange(), BussinessConfig.loginDurationMinutes,true);

        //实例化对象
        GetDeviceShadow instance = new GetDeviceShadow();

        /**
         * 参数名称	数据类型	必填	描述
         * wId	String	是	对象的唯一标识，非空且长度固定36位
         * din	String	是	设备编号
         * Path	String	否	查询的某个子属性，格式类似xxx,xxx，英文逗号分隔
         * token	String	是	动态密钥，有效期20分钟，需重新登录
         * project_id	String	否	项目编号
         */

        //添加参数
        Map<String,Object> map = instance.getExtendsPara();
        map.put("din","144115194541786483");
        map.put("wId","a66348f2-0700-1000-abcd-35269c4636aa");

        //执行HTTP请求及展示结果
        instance.DoHttp();
        CrontabUtil.shutdown();

    }
}
